home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / SOURCE.BIN / Data.java < prev    next >
Encoding:
Java Source  |  1997-06-19  |  3.2 KB  |  131 lines

  1. /*
  2.  * Data.java   1.0   12 Jan 1997
  3.  *
  4.  * Copyright (c) 1996 Krumel & Associates, Inc.  All Rights Reserved.
  5.  *
  6.  * This software is provided as is.  Krumel & Associates shall not be liable
  7.  * for any damages suffered by licensee as a result of using, modifying or
  8.  * distributing this software or its derivatives.
  9.  */
  10.  
  11. package symantec.itools.db.awt;
  12.  
  13. import java.awt.Image;
  14.  
  15. /**
  16.  * Interface defines the API required for classes to provide the values for TableCells
  17.  * stored in a DataSource.
  18.  */
  19. public interface Data {
  20.     /**
  21.      * Supports string data
  22.      */
  23.     public static final int STRING = 1;
  24.     /**
  25.      * Supports image data
  26.      */
  27.     public static final int IMAGE = 2;
  28.     /**
  29.      * Supports string and image data
  30.      */
  31.     public static final int IMAGE_STRING = 3;
  32.  
  33.     /**
  34.      * Base number for user defined data. All values below this value are reserved for
  35.      * this interface.
  36.      */
  37.     public static final int USER_TYPE = 100;
  38.  
  39.     /**
  40.      * The type of data held by object
  41.      */
  42.     public int type();
  43.  
  44.     /**
  45.      * Can the data be altered by the user.
  46.      */
  47.     public boolean isEditable(int row, int col);
  48.  
  49.     /**
  50.      * Has the data been changed by the user since the last commit
  51.      */
  52.     public boolean changed();
  53.  
  54.     /**
  55.      * Places the data in the state as of the previous commit
  56.      */
  57.     public void rollback();
  58.  
  59.     /**
  60.      * Commits the data to the data source
  61.      */
  62.     public void commit() throws TypeNotSupported;
  63.  
  64.     /**
  65.      * Does the data element support choice selection lists by a cell
  66.      */
  67.     public boolean supportsChoice();
  68.  
  69.     /**
  70.      * Gets the applicable choices for the data element
  71.      * @exception   TypeNotSupported Choice lists are not supported by the data element
  72.      */
  73.     public Data[] getChoices() throws TypeNotSupported;
  74.  
  75.     /**
  76.      * Sets the textual value for the data element
  77.      */
  78.     public void setText(String t);
  79.  
  80.     /**
  81.      * Inserts a character into the string value
  82.      * @param pos The position to insert the character
  83.      * @param c The character to insert
  84.      */
  85.     public void insertChar(int pos, char c);
  86.  
  87.     /**
  88.      * Sets the string value of the data element
  89.      */
  90.     public void setText(char c);
  91.  
  92.     /**
  93.      * Appends a character to the string value of the data element
  94.      */
  95.     public void appendChar(char c);
  96.  
  97.     /**
  98.      * Clears all of the text from the string value
  99.      */
  100.     public void clearText();
  101.  
  102.     /**
  103.      * Deletes a character from the string value of the data element
  104.      * @param pos The position of the character to delete
  105.      */
  106.     public void deleteChar(int pos);
  107.  
  108.     /**
  109.      * Gets a substring of the string value of the data element
  110.      * @param spos The starting position of the substring, inclusive
  111.      * @param epos The ending position of the substring, exclusive
  112.      */
  113.     public String subString(int spos, int epos);
  114.  
  115.     /**
  116.      * Sets the image value of the data element
  117.      */
  118.     public void setImage(Image i);
  119.  
  120.     /**
  121.      * Gets the string value for the data element
  122.      */
  123.     public String toString();
  124.  
  125.     /**
  126.      * Gets the image value for the data element
  127.      */
  128.     public Image toImage();
  129. }
  130.  
  131.